<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input id="t" type="text"></input>
</body>
</html>
<script>
    let dom =document.getElementById("t");

    //焦点事件
    dom.onblur=function(){
        console.log("失去焦点");
    }

    dom.onfocus=function(){
        console.log('获取焦点');
    }

</script>